package hust.rpc.lb;

import hust.rpc.pojo.Channel;
import hust.rpc.pojo.RpcRequest;

import java.util.List;
import java.util.concurrent.ThreadLocalRandom;

public class RandomLoadBalance implements LoadBalance {

    @Override
    public Channel next(List<Channel> channels, RpcRequest request) {
        return channels.get(ThreadLocalRandom.current().nextInt(channels.size()));
    }
}
